<template>
    <div class="ad">
        <div :class="getLangbanner1Class">
            <img src="./img/1ping-chatu.png" alt="" />
        </div>
        <div :class="getLangbanner2Class">
            <div class="whole">
                <div
                    :class="banner2hoverIndex === index ? 'extension extension-hover' : 'extension'"
                    v-for="(item, index) in banner2Data"
                    :key="index"
                    @mouseenter="banner2hoverIndex = index"
                >
                    <img src="./img/2ping-beijing1.png" alt="" />
                    <div class="head-box">
                        <img :src="item" alt="" />
                        <h3>{{ $t(`ad.banner2[${index}]['name']`) }}</h3>
                    </div>
                    <div>
                        <h2 class="extension-head">{{ $t(`ad.banner2[${index}]['head']`) }}</h2>
                        <div class="frame"></div>
                        <p class="banner2content">{{ $t(`ad.banner2[${index}]['content']`) }}</p>
                    </div>
                </div>
            </div>
        </div>

        <div :class="getLangbanner3Class">
            <div :class="hoverIndex === i ? 'fiee fiee-hover' : 'fiee'" v-for="(item, i) in banner3Data" :key="i" @mouseenter="hoverIndex = i">
                <div class="magi">
                    <img :src="hoverIndex === i ? item.hoverImg : item.img" class="beijing" />
                </div>
                <div class="padd">
                    <h4 class="name">{{ $t(`ad.banner3[${i}]['name']`) }}</h4>
                    <p class="register">
                        {{ $t(`ad.banner3[${i}]['des']`) }}
                    </p>
                </div>
            </div>
        </div>
        <div>
            <el-carousel height="53.85rem" indicator-position="none" arrow="never" ref="carousel">
                <el-carousel-item v-for="(item, index) in banner4Data" :key="index">
                    <div class="tail">
                        <img :src="item" alt="" />
                        <div class="arrow-box">
                            <img @click="swiperCtrl('prev')" src="./img/4ping-icon-zuo.png" alt="" />
                            <img @click="swiperCtrl('next')" src="./img/4ping-icon-you.png" alt="" />
                        </div>
                        <div class="tail-head">
                            <img :src="getLangbanner4Head" alt="" />
                        </div>

                        <div class="tail-box">
                            <img :src="item" alt="" />
                            <div class="case">
                                <h4>{{ $t(`ad.banner4[${index}]['name']`) }}</h4>
                                <p>{{ $t(`ad.banner4[${index}]['des']`) }}</p>
                                <div class="volume">
                                    <h4>{{ $t(`ad.banner4[${index}]['value']`) }}</h4>
                                    <div>{{ $t(`ad.banner4[${index}]['valueLabel']`) }}</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-carousel-item>
            </el-carousel>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            hoverIndex: 1,
            banner2hoverIndex: 1,
            banner2Data: [
                require("./img/2ping-icon-tuiguangmubiao.png"),
                require("./img/2ping-icon-guanggaoziyuan.png"),
                require("./img/2ping-icon-hailiangshuju.png")
            ],
            banner3Data: [
                {
                    img: require("./img/3ping-icon-mianfeizhuce.png"),
                    hoverImg: require("./img/3ping-icon-mianfeizhuce-Hover.png")
                },
                {
                    img: require("./img/3ping-icon-chengbenkekong.png"),
                    hoverImg: require("./img/3ping-icon-chengbenkekong-Hover.png")
                },
                {
                    img: require("./img/3ping-icon-duozhongjifeimoshi.png"),
                    hoverImg: require("./img/3ping-icon-duozhongjifeimoshi-Hover.png")
                }
            ],
            banner4Data: [require("./img/4p-applovin.png"), require("./img/4p-esteelauder.png"), require("./img/4p-wangzherongyaoliaming.png")]
        };
    },
    components: {},
    mounted() {},

    computed: {
        getLangbanner1Class() {
            const imgs = ["head", "head head-en", "head head-zhc"];
            return imgs[this.$t("callBackImg")];
        },
        getLangbanner2Class() {
            const imgs = ["body", "body body-en", "body body-zhc"];
            return imgs[this.$t("callBackImg")];
        },
        getLangbanner3Class() {
            const imgs = ["banner3", "banner3 banner3-en", "banner3 banner3-zhc"];
            return imgs[this.$t("callBackImg")];
        },
        // getLangbanner2Class() {
        //     const imgs = ["extension-head", "extension-head extension-head-en", "extension-head"];
        //     return imgs[this.$t("callBackImg")];
        // },
        getLangbanner4Head() {
            const imgs = [require("./img/4ping-ibiaoti.png"), require("./img/en/4ping-ibiaoti.png")];
            return imgs[this.$t("callBackImg")];
        }
    },

    methods: {
        swiperCtrl(param) {
            if (param === "prev") {
                this.$refs.carousel.prev();
            } else {
                this.$refs.carousel.next();
            }
        }
    }
};
</script>

<style lang="less" scoped>
.ad {
    padding-top: 80px;
    .head-en {
        background-image: url("./img/en/1-p-banner.png") !important;
    }
    .head {
        background: url("./img/1ping-beijing.png");
        background-size: cover;
        width: 100%;
        height: 1000px;
        text-align: left;
        img {
            margin-left: 375px;
            margin-top: 254px;
            width: 530px;
            transition: all 0.5s;
            &:hover {
                transform: scale(1.2);
            }
        }
    }
    .whole {
        width: 1200px;
        .center();
        justify-content: space-between;
    }

    .extension {
        width: 380px;
        height: 300px;
        box-shadow: 0px 3px 30px 0 #e0e0e0;
        background-color: #ffffff;
        position: relative;
        > img {
            width: 100%;
            height: 100px;
        }
        &-head-en {
            font-size: 16px;
            line-height: 1.5;
        }
        &-head {
            margin: 0 auto;
            width: 300px;
            font-size: 18px;
            line-height: 1.67;
            text-align: justify;
            color: #7d7d7d;
            padding-top: 20px;
        }
        .head-box {
            z-index: 100;
            position: absolute;
            left: 0;
            top: 0;
            .center();
            color: #fff;
            width: 100%;
            justify-content: flex-start;
            transition: all 0.5s;

            img {
                margin: 0 20px;
                height: 100px;
            }
        }
    }
    .extension-hover {
        .head-box {
            background-color: rgba(14, 255, 252, 0.65) !important;
        }
    }
    .data {
        width: 380px;
        height: 300px;
        box-shadow: 0px 3px 30px 0 #e0e0e0;
        background-color: #ffffff;
    }

    .frame {
        margin-left: 2rem;
        margin-top: 20px;
        width: 20px;
        border-bottom: 2px solid #7d7d7d;
    }
    .banner2content {
        padding-left: 2rem;
        padding-right: 40px;
        text-align: left;
        font-size: 16px;
        line-height: 1.5;
        color: #7d7d7d;
        margin-top: 10px;
    }
    .body-en {
        background-image: url("./img/en/2-p-beijing.png") !important;
    }
    .body {
        .center();
        height: 1080px;
        background-color: #fafbfc;
        background: url("./img/2ping-beijing.png");
        background-size: cover;
    }
    li {
        list-style: none;
        width: 100%;
    }
    .banner3-en {
        background-image: url("./img/en/3-p-beijing.png") !important;
    }
    .banner3 {
        height: 1080px;
        width: 100%;
        overflow: hidden;
        background-image: url("./img/3ping-beijing.png");
        background-size: cover;
        .center();
        & .fiee:nth-child(2) {
            margin-left: 20px;
            margin-right: 20px;
        }
        transition: all 0.5s;
    }
    .fiee {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin-top: 7rem;
        width: 300px;
        transition: all 0.5s;
        flex-direction: column;
    }

    .fiee-hover {
        width: 340px;
        transition: all 0.5s;
        .name {
            color: @primary_color;
        }
        .magi {
            height: 190px;
            opacity: 1;
        }
        .padd {
            height: 340px;
        }
    }

    .fiee > img {
        margin-top: 20px;
        display: block;
    }
    .magi {
        .center();
        height: 150px;
        opacity: 0.8;
        background-color: #ffffff;
        transition: all 0.5s;
        width: 100%;
    }

    .padd {
        width: 100%;
        height: 300px;
        background-color: #ffffff69;
        transition: all 0.5s;
    }
    .padd > h4 {
        padding-top: 37px;
        padding-bottom: 37px;
        transition: all 0.5s;
    }

    .padd > p {
        width: 300px;
        text-align: left;
        height: 162px;
        font-size: 18px;
        line-height: 2;
        color: #ffffff;
    }
    .padd > .register {
        text-align: left;
        height: 90px;
        font-size: 18px;
        line-height: 2;
        color: #ffffff;
        padding-left: 35px;
        padding-right: 35px;
        margin: 0 auto;
    }

    .padd > h4 {
        color: #ffffff;
        font-size: 24px;
    }

    .tail {
        position: relative;
        width: 1920px;
        height: 1077px;
        background-color: #ffffff;
        > img {
            opacity: 0.8;
        }
        .arrow-box {
            position: absolute;
            z-index: 1000;
            top: 50%;
            left: 0;
            width: 100%;
            transform: translateY(-50%);
            padding: 0 100px;
            display: flex;
            justify-content: space-between;
            cursor: pointer;
            &:active {
                filter: blur(2px);
            }
        }
        .center();
        .tail-box {
            position: absolute;
            .center();
            justify-content: space-between;
            > img {
                margin-right: 49px;
                box-shadow: 0px 5px 1rem 0 #00000096;
            }
        }
        .tail-head {
            position: absolute;
            top: 179px;
        }
        > img {
            filter: blur(10px);
            width: 100%;
            height: 100%;
        }

        h4 {
            font-size: 24px;
            font-weight: bold;
            color: #272727;
        }
        p {
            width: 558px;
            font-size: 18px;
            line-height: 2;
            text-align: left;
            color: #272727;
            margin-top: 30px;
        }
        .volume {
            margin-top: 23px;
            display: inline-block;
            text-align: center;
            h4 {
                text-shadow: 0px 6px 4px rgba(14, 255, 252, 0.11);
                font-size: 48px;
                font-weight: bold;
                color: #0efffc;
            }
            img {
                margin-top: 20px;
            }
            > div {
                width: 160px;
                height: 50px;
                border-radius: 25px;
                font-weight: bold;
                box-shadow: 0px 6px 4px 0 rgba(14, 255, 252, 0.11);
                background-color: #0efffc;
                font-size: 24px;
                color: #ffffff;
                .center();
                margin-top: 20px;
            }
        }
        .case {
            align-self: flex-start;
            text-align: left;
            padding-top: 10px;
        }
    }
}
</style>
